package com.ruoyi.syf.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.ConvertField;
import com.ruoyi.common.annotation.ConvertFieldItem;
import com.ruoyi.common.enums.ConvertType;
import com.ruoyi.syf.domain.RiskMeasure;
import com.ruoyi.syf.domain.vo.RiskMeasureVo;
import com.ruoyi.syf.mapper.RiskMeasureMapper;
import com.ruoyi.syf.service.IRiskMeasureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 管控措施Service业务层处理
 *
 * @author yr
 * @date 2024-07-04
 */
@Service
public class RiskMeasureServiceImpl extends ServiceImpl<RiskMeasureMapper,RiskMeasure> implements IRiskMeasureService {
    @Autowired
    private RiskMeasureMapper riskMeasureMapper;

    @Override
    public RiskMeasureVo selectRiskMeasureById(Long id) {
        return riskMeasureMapper.getInfoById(id);
    }

    @ConvertField({
            @ConvertFieldItem(fieldName = "dataSrc",dictType = "data_src", type = ConvertType.DICT),
            @ConvertFieldItem(fieldName = "measureSubType", dictType = "#{measureType}",type = ConvertType.DICT),
            @ConvertFieldItem(fieldName = "measureType",dictType = "measure_type", type = ConvertType.DICT)
    })
    @Override
    public List<RiskMeasureVo> list(RiskMeasureVo vo) {
        return riskMeasureMapper.list(vo);
    }

    @Override
    public int insertRiskMeasure(RiskMeasureVo vo) {
        return riskMeasureMapper.insert(vo);
    }

    @Override
    public int updateRiskMeasure(RiskMeasureVo vo) {
        return riskMeasureMapper.updateById(vo);
    }

    @Override
    public int deleteRiskMeasureByIds(Long[] ids) {
        return riskMeasureMapper.deleteRiskMeasureByIds(ids);
    }

    @Override
    public int deleteRiskMeasureById(Long id) {
        return riskMeasureMapper.deleteRiskMeasureById(id);
    }
}
